package domain;

import java.util.Date;
import java.util.Objects;

/**
 * 学生账户类
 *
 * @author liujiale
 */
public class StudentAccount extends Account {

    /** 性别 */
    private boolean gender;

    /** 学院 */
    private String college;

    /** 学号 */
    private String studentID;

    /**
     * 构造函数
     *
     * @param gender    性别，男性为true，女性为false
     * @param college   学院
     * @param studentID 学生ID
     */
    public StudentAccount(boolean gender, String college, String studentID) {
        this.gender = gender;
        this.college = college;
        this.studentID = studentID;
    }

    /**
     * 实现父类的构造函数
     *
     * @param username   用户名
     * @param password   密码
     * @param nickname   昵称
     * @param telephone  电话
     * @param email      邮箱
     * @param createTime 账户创建时间
     * @param gender     性别，男性为true，女性为false
     * @param college    学院
     * @param studentID  学生ID
     */
    public StudentAccount(String username, String password, String nickname, String telephone, String email, Date createTime, boolean gender, String college, String studentID) {
        super(username, password, nickname, telephone, email, createTime);
        this.gender = gender;
        this.college = college;
        this.studentID = studentID;
    }

    public StudentAccount() {
    }


    /**
     * Is gender boolean.
     *
     * @return the boolean
     */
    public boolean getGender() {
        return gender;
    }

    /**
     * Sets gender.
     *
     * @param gender the gender
     */
    public void setGender(boolean gender) {
        this.gender = gender;
    }

    /**
     * Gets college.
     *
     * @return the college
     */
    public String getCollege() {
        return college;
    }

    /**
     * Sets college.
     *
     * @param college the college
     */
    public void setCollege(String college) {
        this.college = college;
    }

    /**
     * Gets student id.
     *
     * @return the student id
     */
    public String getStudentID() {
        return studentID;
    }

    /**
     * Sets student id.
     *
     * @param studentID the student id
     */
    public void setStudentID(String studentID) {
        this.studentID = studentID;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof StudentAccount)) {
            return false;
        }
        if (!super.equals(o)) {
            return false;
        }
        StudentAccount that = (StudentAccount) o;
        return gender == that.gender && Objects.equals(college, that.college) && Objects.equals(studentID, that.studentID);
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), gender, college, studentID);
    }

    @Override
    public String toString() {
        return "StudentAccount{" +
                "gender=" + gender +
                ", college='" + college + '\'' +
                ", studentID='" + studentID + '\'' +
                '}';
    }
}
